<include file="Public:header" />
<div id="zoneHeader">
    <h2>批量修改网址</h2>
    <ul>
        <li><button type="button" class="btnFormEditSave">开始修改</button></li>
        <li><a href="?m={$Think.const.MODULE_NAME}" class="btn">返回</a></li>
    </ul>
</div><!--/#zoneHeader-->
<style type="text/css">
.dl2Col dt { width:150px; }
.dl2Col dd { margin-left:150px; }
.adInfoList{}
.adInfoList li{display:inline-block;margin-right:50px; overflow:auto; border-bottom:1px solid #ccc; }
.adInfoList li input { float:left; }
.adInfoList li span { float:left; }
.adInfoList li dl { float:left; overflow:auto;}
.adInfoList li dl dt { float:left; width:80px; }
.adInfoList li dl dd { margin-left:80px; }

.url_item { margin-bottom:5px; }
.url_item b { display:inline-block; width:80px; }
</style>
<div id="zoneBody">
    <div id="zoneBodyContent">
        <form action="?m=Plan&a=doChangeUrl" id="formEdit">
        <input type="hidden" name="plan_id" value="{$_GET['id']}" />
        <dl class="dl2Col">
            <dt>所属计划：</dt>
            <dd>{:getPlanNameById($_GET['id'])}</dd>
            <dt>新网址：</dt>
            <dd>
                <table class="table3">
                    <thead>
                        <tr>
                            <td width="100">设备</td>
                            <td>网址</td>
                        </tr>
                    </thead>
                    <tbody>
                        <volist name="plan_devices" id="vo">
                        <tr>
                            <td>{$vo.pd_device|getPlanDeviceNameById}</td>
                            <td>
                                <input type="text" name="url_{$vo.pd_device}" value="{$vo.pd_url}" />
                                <label><input type="checkbox" name="change_plan_url_{$vo.pd_device}" value="1" checked="checked" /><span>修改计划对应网址</span></label>
                            </td>
                        </tr>
                        </volist>
                    </tbody>
                </table>
            </dd>
            <dt>&nbsp;</dt>
            <dd><a href="javascript:;" action="selectAll">全选</a><a href="javascript:;" style="margin-left:10px" action="invertSelect">反选</a><a href="javascript:;" style="margin-left:10px" action="cancelSelect">取消选择</a></dd>
            <dt>广告编号及网址：</dt>
            <dd>
                <ul class="adInfoList">
                    <volist name="record" id="vo">
                    <li>
                        <label><input type='checkbox' name="ad_id[]" value="{$vo.ad_id}" /><span class="adInfoId" title="广告编号">{$vo.ad_id}</span>
                            <dl>
                                <dt>PC：</dt>
                                <dd>{$vo.url_1}&nbsp;</dd>
                                <dt>Android：</dt>
                                <dd>{$vo.url_2}&nbsp;</dd>
                                <dt>IOS：</dt>
                                <dd>{$vo.url_3}&nbsp;</dd>
                                <dt>W.P.：</dt>
                                <dd>{$vo.url_4}&nbsp;</dd>
                            </dl>
                            </label></li>
                    </volist>
                </ul>
            </dd>
        </dl>
        </form>
    </div><!--/#zoneBodyContent-->
</div><!--/#zoneBody-->
<script type="text/javascript">
$(function(){
    var $o = $('#zoneBody');

    $o.on('click', '[action=selectAll]', function(){
        var $item = $o.find('[name=ad_id\\[\\]]');
        $item.attr('checked', true);
    });

    $o.on('click', '[action=invertSelect]', function(){
        var $item = $o.find('[name=ad_id\\[\\]]');

        $item.each(function(k, v){
            var status = $(this).attr('checked') ? false : true;
            $(this).attr('checked', status);
        })
    });

    $o.on('click', '[action=cancelSelect]', function(){
        var $item = $o.find('[name=ad_id\\[\\]]');
        $item.attr('checked', false);
    })


});
</script>
<include file="Public:footer" />
